<%-- 
    Document   : applyList
    Created on : 2014-1-24, 17:28:54
    Author     : chensy
--%>

<%@page contentType="text/html; charset=UTF-8" session="false" %>
<%@include  file="/WEB-INF/jspf/import.jspf"%>
<div class="pageHeader">
    <form onsubmit="return navTabSearch(this);" id="pagerForm" name="searchForm" method="get">
        <input type="hidden" name="pageNum" value="${pager.pageNo}" />
        <input type="hidden" name="pageSize" value="${pager.pageSize}" />
        <input type="hidden" name="orderField" value="${orderField}" />
        <input type="hidden" name="orderDirection" value="${orderDirection}" />
        <div class="searchBar">
            <table class="searchContent">
                <tbody>
                    <tr>
                        <td><label>车友会名称：</label><input type="text" name="name" value="${name}" class="textInput"></td>
                        <td><label>地区：</label><input type="text" name="area" value="${area}" class="textInput"></td>
                        <td><label>申请时间：</label>
                            <input type="text" value="${beginDate}" datefmt="yyyy-MM-dd 00:00:00" name="beginDate" class="date" readonly="true">
                            至
                            <input type="text" value="${endDate}" datefmt="yyyy-MM-dd 23:59:59" name="endDate" class="date" readonly="true">
                        </td>
                    </tr>
                    <tr>
                        <td><label>品牌：</label><input type="text" name="brand"  value="${brand}" class="textInput"></td>
                        <td><label>申请状态：</label>
                            <select  name="status">
                                <c:forEach var="e" items="${statusDesc}">
                                    <option value="${e.key}"<c:if test="${e.key==status}">selected</c:if> >${e.value}</option>
                                </c:forEach>
                            </select>
                        </td>
                        <td><label>分区：</label>
                            <select  name="region">
                                <option value="0" ${region==0?"selected":""}>请选择</option>
                                <option value="1" ${region==1?"selected":""}>华北区</option>
                                <option value="2" ${region==2?"selected":""}>华东区</option>
                                <option value="3" ${region==3?"selected":""}>华中区</option>
                                <option value="4" ${region==4?"selected":""}>华南区</option>
                                <option value="5" ${region==5?"selected":""}>西南区</option>
                                <option value="6" ${region==6?"selected":""}>西北区</option>
                                <option value="7" ${region==7?"selected":""}>东北区</option>
                                <option value="8" ${region==8?"selected":""}>港澳台</option>
                            </select>
                        </td>
                          <td><label>处理状态：</label>
                                  <select  name="dispose">
                                      <option value="-1" ${disposeStatus==-1?"selected":""}>请选择</option>
                                      <option value="0" ${disposeStatus==0?"selected":""}>未处理</option>
                                      <option value="1" ${disposeStatus==1?"selected":""}>处理中</option>
                                      <option value="2" ${disposeStatus==2?"selected":""}>处理完成</option>
                                  </select>
                          </td>
                    </tr>

                </tbody>
            </table>
            <div class="subBar">
                <ul>
                    <li><div class="buttonActive"><div class="buttonContent"><button type="submit">查询</button></div></div></li>
                </ul>
            </div>
        </div>
    </form>
</div>
<div class="panelBar">
    <ul class="toolBar">
        <c:if test="${status == 0 || status == 2}">
            <li><a class="icon" href="${ROOT}/admin/club/editStatus.do?status=1" rel="ids" target="selectedTodo" title="确定要通过吗？"><span>通过</span></a></li>
        </c:if>
        <c:if test="${ status == 2}">
            <li><a class="icon" href="${ROOT}/admin/club/remove.do" rel="ids" target="selectedTodo" title="确定要删除吗？"><span>删除</span></a></li>
        </c:if>
        <c:if test="${status == 3 }">
            <li><a class="icon" href="${ROOT}/admin/club/editStatus.do?status=1" rel="ids" target="selectedTodo" title="确定要解封吗？"><span>解封</span></a></li>
        </c:if>
        <c:if test="${status == 4 }">
            <li><a class="icon" href="${ROOT}/admin/club/editStatus.do?status=1" rel="ids" target="selectedTodo" title="确定要解锁吗？"><span>解锁</span></a></li>
        </c:if>
        <c:if test="${status == 0 }">
            <li><a class="icon" data-url="${ROOT}/admin/club/rejectMsg.do?status=2&ids=" href="javascript:void(0)" title="确定要拒绝吗？" id="rejectBtn" onclick="return checkSelectIds();" ><span>拒绝</span></a></li>
        </c:if>
        <c:if test="${status == 1 }">
              <!-- li><a class="icon" href="${ROOT}/admin/club/editStatus.do?status=3" rel="ids" target="selectedTodo" title="确定要封该车友会吗？"><span>封</span></a></li -->
            <li><a class="icon" href="${ROOT}/admin/club/editStatus.do?status=4" rel="ids" target="selectedTodo" title="确定要锁定该车友会吗？"><span>锁</span></a></li>
        </c:if>
    </ul>
</div>
<div class="pageContent">
    <table class="table" style="width: 100%" layoutH="163">
        <thead>
            <tr>
                <th width="2%"><input type="checkbox" class="checkboxCtrl" group="ids"></th>
                <th width="5%">创建人ID</th>
                <th width="6%">车友会ID</th>
                <th width="6%">车友会名称</th>
                <th width="5%">个性域名</th>
                <th width="5%">主题</th>
                <th width="5%">地区</th>
                <th width="5%">车系</th>
                <th width="5%">真实姓名</th>
                <th width="7%">QQ群</th>
                <th width="6%">联系方式</th>
                <th width="5%">地址</th>
                <th width="5%">申请时间</th>
                <th width="5%">申请状态</th>
                <th width="10%">拒绝理由</th>
                <th width="10%">处理状态</th>
                <th width="5%">操作</th>
                <th width="5%">备注</th>
            </tr>
        </thead>
        <tbody>
            <c:forEach var="e" items="${pager.resultList}">
                <tr>
                    <td><input type="checkbox" name="ids" value="${e.clubId}"/></td>
                    <td><a href="${UCROOT}/${e.createBy}/" target="_blank">${e.createBy}</a></td>
                    <td>${e.clubId}</td>
                    <td>${fn:escapeXml(e.name)}</td>
                    <td>${fn:escapeXml(e.clubUrl)}</td>
					<td>${e.theme.themeName}</td>
                    <td>${fn:escapeXml(e.provinceName)}&nbsp;&nbsp;${fn:escapeXml(e.cityName)}</td>
                    <td>${fn:escapeXml(e.brandName)}&nbsp;&nbsp;${fn:escapeXml(e.seriesName)}</td>
                    <td>${fn:escapeXml(e.address.name)}</td>
                    <td title="${fn:escapeXml(e.qqGroup)}">${fn:escapeXml(e.qqGroup)}</td>
                    <td>${fn:escapeXml(e.address.phone)}</td>
                    <td title="${fn:escapeXml(e.address.provinceName)}&nbsp;&nbsp;${fn:escapeXml(e.address.cityName)}&nbsp;&nbsp;${fn:escapeXml(e.address.address)}">${fn:escapeXml(e.address.provinceName)}&nbsp;&nbsp;${fn:escapeXml(e.address.cityName)}&nbsp;&nbsp;${fn:escapeXml(e.address.address)}</td>
                    <td><fmt:formatDate value="${e.createAt}" pattern="yyyy-MM-dd"/></td>
                    <td>${statusDesc[e.status]}</td>
                    <td title="${fn:escapeXml(e.rejectMsg)}">${fn:escapeXml(e.rejectMsg)}</td>
                    <td>
                        <label id="clubDispose_${e.clubId}" value="${e.clubDispose.status}">${e.clubDispose.status==0?"未处理":e.clubDispose.status==1?"处理中":e.clubDispose.status==2?"处理完成":""}</label>
                        <select  id="dispose_${e.clubId}" style="display:none;font-size:12px;" width="50px;">
                            <option value="0" ${e.clubDispose.status==0?"selected":""}>未处理</option>
                            <option value="1" ${e.clubDispose.status==1?"selected":""}>处理中</option>
                            <option value="2" ${e.clubDispose.status==2?"selected":""}>处理完成</option>
                        </select>
                        <a href="javascript:editDispose(${e.clubId});" title="修改" style="color:blue;" id="editButton_${e.clubId}">修改</a>
                        <a href="javascript:submitDispose(${e.clubId});" title="确定" id="submitButton_${e.clubId}" style="color:blue; display: none;">确定</a>
                        <a href="javascript:cancelDispose(${e.clubId});" title="取消" id="cancelButton_${e.clubId}" style="color:blue; display: none;">取消</a>
                    </td>
                    <td>
                        <c:if test="${e.status==0 || e.status==2}">
                            <a target="ajaxTodo" href="${ROOT}/admin/club/editStatus.do?status=1&&ids=${e.clubId}" title="确定要通过吗？" style="color:blue;">通过</a>
                        </c:if>
                        <c:if test="${ status == 2}">
                            <a target="ajaxTodo" href="${ROOT}/admin/club/remove.do?ids=${e.clubId}" title="确定要删除吗？" style="color:blue;">删除</a>
                        </c:if>
                        <c:if test="${e.status==0 }">
                            <a  style="color:blue;" height="380" width="550" href="${ROOT}/admin/club/rejectMsg.do?status=2&&ids=${e.clubId}" title="确定要拒绝吗？" target="dialog"  ><span>拒绝</span></a>
                        </c:if>
                        <c:if test="${e.status==1}">
                            <!-- a target="ajaxTodo" href="${ROOT}/admin/club/editStatus.do?status=3&&ids=${e.clubId}"  title="确定要封吗？" style="color:blue;">封</a -->
                            &nbsp;
                            <a target="ajaxTodo" href="${ROOT}/admin/club/editStatus.do?status=4&&ids=${e.clubId}"  title="确定要锁定吗？" style="color:blue;">锁</a>
                        </c:if>
                        <c:if test="${e.status==3}">
                            <a target="ajaxTodo" href="${ROOT}/admin/club/editStatus.do?status=1&&ids=${e.clubId}" title="确定要解封吗？" style="color:blue;">解封</a>
                        </c:if>

                        <c:if test="${e.status==4}">
                            <a target="ajaxTodo" href="${ROOT}/admin/club/editStatus.do?status=1&&ids=${e.clubId}" title="确定要解锁吗？" style="color:blue;">解锁</a>
                        </c:if>
                    </td>
                    
                    <td><a href="${ROOT}/admin/club/editRemark.do?clubId=${e.clubId}" target="dialog" rel="list-club-audit-remark" width="500" height="300" style="color:blue;">查看</a>
                   </td> 
                </tr>
            </c:forEach>
        </tbody>
    </table>

</div>
<div class="panelBar">
    <div class="pages">
        <span>共 ${pager.total} 条</span>
    </div>
    <div class="pagination" targetType="navTab" totalCount="${pager.total}" numPerPage="${pager.pageSize}" pageNumShown="10" currentPage="${pager.pageNo}"></div>
</div>
<script type="text/javascript">
    function editDispose(clubId){
        $("#clubDispose_"+clubId).hide();
        $("#dispose_"+clubId).show();
        $("#editButton_"+clubId).hide();
        $("#submitButton_"+clubId).show();
         $("#cancelButton_"+clubId).show();
    }
    function submitDispose(clubId){
        var select  =  $("#dispose_"+clubId+" option:selected");
        var disposeStatus = select.val();
        $.post("${ROOT}/admin/club/updateClubDisposeStatus.do",{clubId:clubId,status:disposeStatus},function(data,resposeText,asg){
            var json = eval("("+asg.responseText+")");
            navTabAjaxDone(json);
        });
    }
    function cancelDispose(clubId){
        $("#clubDispose_"+clubId).show();
        $("#dispose_"+clubId).hide();
        $("#editButton_"+clubId).show();
        $("#submitButton_"+clubId).hide();
        $("#cancelButton_"+clubId).hide();
        $("#dispose_"+clubId+" option:selected").removeAttr("selected");
        $("#dispose_"+clubId+" option[value='"+ $("#clubDispose_"+clubId).attr("value")+"']").attr("selected","selected");
       
    }
</script>
<script>
    function checkSelectIds(){
        var $checkBoxs = $("input[name='ids']:checked");
        if($checkBoxs.length==0){
            alertMsg.error('请选中需要拒绝的车友会')
            return false;
        }
        var href = $("#rejectBtn").attr("data-url");
        $checkBoxs.each(function(){
            href += $(this).val() + ",";
        });
        $.pdialog.open(href, "rejectDialog", $("#rejectBtn").attr("title"),{height:380,width:550});
        return false;
    }
</script>
